/*
* @Author: Yejing
* @Date: 2023-06-16 16:19:44
* @LastEditors: Yejing
* @LastEditTime: 2023-07-20 18:12:02
* @Description: 分类处理
*/
<template>
	<view>
		<view class="card" v-for="(item,index) in cardData"
      @click="click2Detail(item)" :key="index"
			:class="item.status == '2'?'underway':''">
			<view class="line" v-if="type != 'anchor'">
				<uni-tooltip :content="item.taskName " @click.stop=''>
					<view style="color: #fff; font-size: 14px; width: 140px;display: inline-block;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: normal;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 1;">	{{ item.taskName }}</view>
				</uni-tooltip>
				<text>
					<text style="font-size: 20rpx; color: rgba(255,255,255,0.5);" v-if="item.status == 5">{{ item.time }}
					</text>
				</text>
				<!--未通过-->
				<text style="color:#F85F69" v-if="item.status == 1">
					{{$t('orderDetails.Unapprove')}}
					<u-icon name="question-circle"></u-icon>
				</text>
				<!--审核中-->
				<text style="color: rgba(255,255,255,0.5);" v-if="item.status == 0">
						{{$t('orderDetails.UnderReview')}}
					<u-icon name="info-circle" color="#fff"></u-icon>
				</text>

				<!--进行中-->
				<view v-if="item.status == 2" style="display: flex;align-items: center">
					<text style="color: rgba(255,255,255,0.6);font-size: 24rpx">
						{{ $t('product.InProgress')}}
					</text>
					<!--                    <text style="font-size: 28rpx;margin: 0 8rpx 0 18rpx;color: #FF8900">
                        观看
                    </text> -->
					<!-- <u-icon name="play-circle" color="#FF8900" size="35"></u-icon> -->
				</view>

				<!--已完成-->
				<view v-if="item.status == 5" style="display: flex;align-items: center">
					<text style="color: rgba(255,255,255,0.6);font-size: 24rpx">
						{{ item.status }}
					</text>
					<text style="font-size: 28rpx;margin: 0 8rpx 0 18rpx;color: #fff">
						{{$t('product.orderDetailsTitle')}}
					</text>
					<u-icon name="info-circle" color="#fff" size="35"></u-icon>
				</view>

			</view>

			<!--            主播-->
			<view class="line" v-else>
				<text>
				<uni-tooltip :content="item.taskName " @click.stop=''>
					<view style="color: #fff; font-size: 14px; width: 140px;display: inline-block;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: normal;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 1;">	{{ item.taskName }}</view>
				</uni-tooltip>
					<text style="font-size: 20rpx; color: rgba(255,255,255,0.5);" v-if="item.status == 5">{{ item.time }}
					</text>
				</text>
				<!--未申请-->
				<view style="color:#F85F69;display:flex" v-if="item.status ==4">
					{{$t('product.notApply')}}
		
				</view>
				<!--未通过-->
				<view style="color:#F85F69;display:flex" v-if="item.status ==5">
					{{$t('orderDetails.Unapprove')}}
				</view>
				<!--审核中-->
				<text style="color: rgba(255,255,255,0.5);" v-if="item.status == 0">
					{{$t('product.NotProgress')}}
					<u-icon name="info-circle" color="#fff"></u-icon>
				</text>

				<!--进行中-->
				<view v-if="item.status == 1" style="display: flex;align-items: center">
					<text style="color: rgba(255,255,255,0.6);font-size: 24rpx">
						{{ $t('product.InProgress')}}
					</text>
					<!--                    <text style="font-size: 28rpx;margin: 0 8rpx 0 18rpx;color: #FF8900">
                                            观看
                                        </text> -->
					<!-- <u-icon name="play-circle" color="#FF8900" size="35"></u-icon> -->
				</view>

			<!--待结算-->
			<view v-if="item.status == 2" style="display: flex;align-items: center">
				<text style="color: rgba(255,255,255,0.6);font-size: 24rpx">
					{{ $t('product.unbalanced')}}
				</text>
			
			</view>
			<!--已结算-->
			<view v-if="item.status == 3" style="display: flex;align-items: center">
				<text style="color: rgba(255,255,255,0.6);font-size: 24rpx">
					{{ $t('product.balanced')}}
				</text>
			
			</view>
			</view>


			<view class="product">
				<view class="" style="width: 100px;">
					{{$t('storeManagement.TaskGoods')}}:
				</view>
				
				<text class="remove">{{ item.taskProductName }}</text>
			</view>
			<view class="intro">
				{{ item.taskInfo }}
			</view>
			<view class="bottom">
				<!--                                            <view v-if="item.status == '已完成'">-->
				<!--                                                <u-button type="primary">去结算</u-button>-->
				<!--                                            </view>-->
				<!--                                            <view v-else>-->
				<!--                                                <text style="color: black">{{ item.tag }}</text>-->
				<!--                                                <text>{{ item.time }}</text>-->
				<!--                                            </view>-->
				<text style="color: black">{{ item.taskBenefitType }}</text>
				<!--                <u-button type="primary" v-if="item.status == '已完成'">去结算</u-button>-->
			{{publicJS.timeZoneSwitching(item.createTime)}}
			</view>
		</view>
	</view>
</template>

<script>
export default {
		props: {
			cardData: {
				type: Array,
				default: []
			},
			type: {
				type: String,
				default: ''
			}
		},
		data() {
			return {};
		},
    methods: {
      click2Detail(item) {
        if (item.status === 3) {
          //已结算 到新页面
          uni.navigateTo({
            url: "/pages/anchorConsole/page/FinishTaskDetail" + "?taskId=" + item.id,
          })
        } else {
          //旧的逻辑不变
          this.$u.route('pages/anchorConsole/page/taskDetails', {
            type: this.type === 'anchor' ? 'applyKb' : this.type,
            status: item.status,
            taskId: item.id
          });
        }
      }
    },

	}
</script>

<style lang="scss" scoped>
	.card {
		width: 100%;
		height: 272rpx;
		background: #1B1D29;
		box-shadow: 0rpx 8rpx 20rpx 0rpx rgba(0, 0, 0, 0.302);
		border-radius: 26rpx 26rpx 26rpx 26rpx;
		opacity: 1;
		color: #fff;
		padding: 24rpx 32rpx;
		font-size: 28rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		margin-bottom: 30rpx;

		&:nth-child(1) {
			margin-top: 40rpx;
		}

		.line {
			display: flex;
			justify-content: space-between;

			uni-text {
				&:nth-child(2) {
					.u-icon {
						margin-left: 10rpx;
					}
				}
			}

		}
.intro{
				    display: -webkit-box;
				    overflow: hidden;
				    text-overflow: ellipsis;
				    white-space: normal;
				    -webkit-box-orient: vertical;
				    -webkit-line-clamp: 2;
			}
		.product {
			font-size: 24rpx;
			color: #76777E;
			display: flex;
			
			.remove {
				width: calc(100% - 130rpx);
			}

			uni-text {
				color: #fff;
				margin-left: 30rpx;
			}
		}

		.bottom {
			display: flex;
			justify-content: space-between;
			font-size: 24rpx;
			color: rgba(255, 255, 255, 0.8);
			align-items: center;

			uni-text {
				&:nth-child(1) {
					padding: 10rpx 20rpx;
					background: rgba(255, 255, 255, 0.5);
					box-shadow: inset 0rpx 4rpx 12rpx 0rpx rgba(255, 255, 255, 0.3);
					border-radius: 4rpx 4rpx 4rpx 4rpx;
					opacity: 1;
				}
			}

			uni-button {
				width: 180rpx;
				height: 64rpx;
				background: #2934D0;
				border-radius: 20rpx 20rpx 20rpx 20rpx;
				opacity: 1;
				margin: 0;
			}
		}
	}

	.underway {
		background: #2934D0;
	}

	.remove {
		overflow: hidden; //超出隐藏
		text-overflow: ellipsis; //溢出显示省略号
		white-space: normal; //常规默认，会折行
		display: -webkit-box;
		-webkit-box-orient: vertical; //子元素排列 vertical（竖排）orhorizontal（横排）
		-webkit-line-clamp: 2;
		/*内容限制的行数 需要几行写几就行*/
	}
</style>